import 'tdesign-vue-next/es/style/index.css';
import '@/style/index.less';

import { createApp } from 'vue';

import TDesign from 'tdesign-vue-next';
import { store } from './store';
import { format, has, LgIcon } from '@/soar';
import directives from './soar/directives';
import locales from './locales';
import router from './router';
import './permission';
import { push } from '@/api/log';
import btns from '@/components/btns';
import App from './App.vue';

const app = createApp(App);

app.use(directives);
app.use(store);
app.use(locales);
app.use(router);
app.use(TDesign);
app.use(btns);
app.component('LgIcon', LgIcon);
// 全局属性
app.config.globalProperties.$ToolBtnLimit = 3; // 工具栏按钮数量
app.config.globalProperties.$RowBtnLimit = 2; // 操作栏按钮数量
// 全局方法
app.config.globalProperties.$has = has; // 权限验证
app.config.globalProperties.$format = format; // 格式化
// 挂载应用
app.mount('#app');

app.config.errorHandler = function handleError(err, vm, info) {
  try {
    // 收集异常堆栈信息
    push('vue', err.stack);
  } finally {
    // 输出异常信息
    console.error(err);
  }
};


